How to dynamically enable/disable addin menu items

I've created a DOORS addin which has both an explorer menu and a formal module menu which DOORS automatically creates (as a new top-level menu).

How can I dynamically enable or disable menu items? 

The module menu has items which should only be enabled if certain attributes are present in the module.

 

The createMenu() function uses a mapping function, but DOORS is creating the menus for me automatically (from the addin directory configuration). Is there a function that I can call to enable/disable a menu item, or alternatively, is there another way for my addin to create the menus it needs?

 


TheNybbler - Fri Jul 17 11:34:00 EDT 2015

Re: How to dynamically enable/disable addin menu items
pommCannelle - Tue Jul 21 08:41:28 EDT 2015

hi !

The createMenu function introduces the createItem calls .... 
Use one of the calls using a mapping function in order to be able to dynamically enable/disable menus. 
The mapping function should be loaded at the start of your session -> put your dxl in 'DOORS\MM.mm\lib\dxl\startupFiles' directory.

Here an example of mapping function (i use it to enable/disable functions in the popup menu ... )

int lock_allowed(){
        Module mod = current Module
        if (null mod) return null
        if ( isShare mod ) return menuAvailable_
        return menuUnavailable_
}

Enjoy !

Re: How to dynamically enable/disable addin menu items
TheNybbler - Wed Jul 22 11:23:34 EDT 2015

pommCannelle - Tue Jul 21 08:41:28 EDT 2015

hi !

The createMenu function introduces the createItem calls .... 
Use one of the calls using a mapping function in order to be able to dynamically enable/disable menus. 
The mapping function should be loaded at the start of your session -> put your dxl in 'DOORS\MM.mm\lib\dxl\startupFiles' directory.

Here an example of mapping function (i use it to enable/disable functions in the popup menu ... )

int lock_allowed(){
        Module mod = current Module
        if (null mod) return null
        if ( isShare mod ) return menuAvailable_
        return menuUnavailable_
}

Enjoy !

Thanks for the tip, but I'm not creating the menus myself - they are being auto created by DOORS when it loads the addin.

Do you know how I can enable/disable these auto-created menu items?